package java_DesignPattern.StructuralPattern.FlyweightPattern;

/**
 * 享元模式---测试类
 */
public class Test {

    public static void main(String[] args) {

        AbstractShape i = FlyweightFactory.getInstance().getShape("I");
        i.display("蓝色");

        AbstractShape l1 = FlyweightFactory.getInstance().getShape("L");
        l1.display("蓝色");

        AbstractShape l2 = FlyweightFactory.getInstance().getShape("L");
        l2.display("红色");

        System.out.println("l1与l2是否为同一个对象"+(l1 == l2));
    }
}
